
import 'package:flutter/material.dart';

import '../../../components/select_menu/MenuItem.dart';
import '../../../components/select_menu/SelectWidget.dart';
import '../../../utils/custom_appbar.dart';

class Test extends StatefulWidget {
  _TestState createState() => _TestState();
}

class _TestState extends State<Test> {
  String value = "1";

  /// 下拉选择值改变
  selectChange(value) {
    print("值改变了：$value");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: customAppbar(
        title: "下拉菜单演示",
      ),
      body: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          SelectWidget(
            items: [
              MenuItem(label: "张飞", value: '1'),
              MenuItem(label: "关羽", value: '2'),
              MenuItem(label: "刘备", value: '3'),
              MenuItem(label: "亚瑟", value: '4'),
              MenuItem(label: "妲己", value: '5'),
              MenuItem(label: "兰陵王", value: '6'),
            ],
            value: value,
            valueChanged: selectChange,
          ),
        ],
      ),
    );
  }
}
